You must read the message regarding software licenses in the Section called Third Party Software Licensing and Temporary Files in Chapter 1 before you install Windows 98 as a guest operating system in Bochs.
There are two ways to get Windows 98 running as a guest operating system in Bochs:
mcopy Windows 98 - The first method is to copy files from a functional Windows 98 installation partition. This initially will be less time consuming, as you will not have to install the OS or the applications running on it. On the other hand, you do not have the benefit of having an new installation especially geared for Bochs. You will need mtools and your Windows 98 CD-ROM.
Classic Install - The second method is to do a fresh installation of Windows 98 on your virtual hardware. This is a slow, tedious process. You will have the benefits, however, of having a clean registry and a slimmer installation running only the components you need. All you need for this method is your Windows 98 CD-ROM and your license key.
You should NOT use your existing Windows 98 installation for both your real hardware and as a guest OS in Bochs. When Windows 98 detects changes in hardware, it will make changes in the installation. It will deactivate certain drivers and devices and activate or install others. This is what happens when you run an existing installation for the first time in Bochs.
In this method, files will simply be copied from a functional Windows 98 partition. For the impatient, here is a short summary:
Remove unnecessary files from your Windows partition.
Create a disk image with bximage.
Update your .bochsrc configuration file for the diskimage.
Use mtools to partition and format the image; the copy all the windows files to the image.
Finally, start the simulation and let Windows reconfigure itself.
Make sure that your MS Windows partition is mounted. Check /etc/fstab to see if and where it is mounted. For more information on fstab, type man fstab at the command prompt. You may also very carefully type fdisk -l and df as root for more information on the partitions of your computer. For example:
# cat /etc/fstab /dev/hda7 / reiserfs defaults 1 1 /dev/hda5 /boot ext2 defaults 1 2 /dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0 devpts /dev/pts devpts defaults 0 0 /dev/hda3 /home reiserfs defaults 1 2 /dev/hda1 /home2 ext2 defaults 1 2 /dev/fd0 /media/floppy auto noauto,user,sync 0 0 proc /proc proc defaults 0 0 usbdevfs /proc/bus/usb usbdevfs defaults,noauto 0 0 /dev/hda6 swap swap pri=42 0 0 # fdisk -l Disk /dev/hda: 255 heads, 63 sectors, 1247 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 510 4096543+ b Win95 FAT32 /dev/hda2 511 794 2281230 5 Extended /dev/hda3 795 1247 3638722+ 83 Linux /dev/hda5 511 513 24066 83 Linux /dev/hda6 514 539 208813+ 82 Linux swap /dev/hda7 540 794 2048256 83 Linux # df Filesystem 1k-blocks Used Available Use% Mounted on /dev/hda7 2048188 1844552 203636 91% / /dev/hda5 23302 3584 18515 17% /boot /dev/hda3 3638604 549220 3089384 16% /home shmfs 63240 0 63240 0% /dev/shm //server/C$ 4096512 3808000 288512 93% /shares/SERVER1/c //server/D$ 13823744 3854848 9968896 28% /shares/SERVER1/d /dev/hda1 4032092 1897220 3794432 50% /windows/c |
In this example, the Windows partition is on /dev/hda1. It is mounted as /windows/c and is it taking up 1,897,220 bytes, or roughly 2 gigabytes. This means that the disk image you would need to create in this instance would need to be at least that size if you plan to put all the files from your Windows partition there.
You will save some space if you omit what is in your My Documents and Windows Update directory. You may also want to use the Windows Disk Cleanup to delete all your temporary files:
Reboot into Windows 98
Double click on "My Computer"
Right click on your "C" drive. A small menu should appear.
Click on "Properties"
Click on "Disk Cleanup"
Make sure "Temporary Internet Files", "Temporary Files", "Downloaded Program Files", and "Recycle Bin" are all selected.
Click on the "OK" button.
When it says "Are you sure you want to delete files?", click "Yes"
You will want to minimize the amount of files you will have to transfer to your new disk image. Before you reboot into Linux, you may want to do a search for *.tiff, *.jpg, *.avi, *.mov, *.mpg, *.mp3, *.wav, *.ra, *.rm, *.ram, and *.wmf files. Move these somewhere under the My Documents hierarchy. Do so only if it does not disrupt your setup, and if the files are not already there:
Open up My Documents
From the File Menu, click on File => New => Folder
Type big_files in the folder name box.
Double Click on the big_files folder. Leave this window open.
Click on Start => Find => Files or Folders
In the Named: input box, type *.tiff, *.jpg, *.avi, *.mov, *.mpg, *.mp3 *.wav *.ra *.rm *.ram *.wmf
The Look In field should be C:\, and the Inlcude Subfolders checkbox should be checked.
Press Enter.
Drag and drop files that are NOT part of a program, NOT in the Program Files Directory, and NOT in the Windows directory into an empty space in your big_files folder. Be sure you know what you are moving.
When the files are done moving, reboot into Linux: Start => Shutdown => OK
If you have a Network File System (NFS) mounted, you could also use these files as source files. In example shown in the previous section, the filesystem mounted on /share/SERVER1/c is from a Windows 2000 server.
If your Windows 98 partition is not mounted, and it lives on /dev/hda1, type the following as root:
mkdir /windows mkdir /windows/c mount -t vfat /dev/hda1 /windows/c/ ls /windows/c/ |
You should now see the Windows 98 partition's directories, to include Windows and Program Files these two directories are key to your new guest installation.
You are going to prepare two disk images, the primary hard disk image, and the backup image. The backup image will save you from disaster when you make a change that makes your first image unusable. This backup image is not required, but it is highly recommended. The primary disk image will be called c.img The backup image will be called c.img.bak . You must consider several things when choosing the size of the disk image:
The size of your Windows installation.
The amount of free space you have available in your home directory. If you do not have enough free space in your home directory, find another partition to put this image on, and ensure that you have the proper permissions for this file (type man chmod).
Whether or not you choose to have a concurrent backup image in your home directory (c.img.bak). If you do this, you will need twice as much space.
It is important to keep your guest OS image independent of your office files so that you can easily restore your setup to a previous state without changing your office files, in case something did not go right. I cannot stress enough the importance of doing this.
Once you have decided on the size of your hard disk image, follow the instructions in the Section called How to make a simple disk image in Chapter 8 using the mtools method. Start by making a directory called ~/win98 .
[david@domain]$ mkdir ~/win98 [david@domain]$ cd ~/win98 [david@domain]$ bximage ======================================================================== bximage Disk Image Creation Tool for Bochs ======================================================================== Do you want to create a floppy disk image or a hard disk image? Please type hd or fd. [hd] hd What kind of image should I create? Please type flat, sparse or growing. [flat] Enter the hard disk size in megabytes, between 1 and 32255 [10] 1 I will create a hard disk image with cyl=2 heads=16 sectors per track=63 total sectors=2016 total size=0.98 megabytes What should I name the image? [c.img] Writing: [] Done. I wrote 1032192 bytes to c.img. The following line should appear in your bochsrc: ata0-master: type=disk, path="c.img", cylinders=2, heads=16, spt=63 [david@domain]$ |
If you are creating a 2 gig image, you will want to type 2000 when it asks you for the size, instead of 1, as I did in this example.
Now that you have the disk image information, it is time to create the ~/win98/.bochsrc file. In the following example, you will need to replace all instances of /home/david/ with your own home directory. All paths in the ~/win98/.bochsrc file must be absolute.
# .bochsrc FILE FOR WINDOWS 98 AS GUEST OS IN LINUX # Set aside the RAM for bochs and make sure you have enough RAM left over for your system. # Type "cat /proc/meminfo" at the prompt to find out how much RAM you have. megs: 64 # Filename of ROM images go here. Be sure to check your installation for the location # of these two files (type: man find). Paths must be absolute. romimage: file=/usr/local/etc/bochs/bios/BIOS-bochs-latest, address=0xf0000 vgaromimage: /usr/local/etc/bochs/bios/VGABIOS-elpin-2.40 # Floppies are commented out, but you may need them later. # floppya: 1_44=/dev/fd0, status=inserted # floppyb: 1_44=/home/david/win98/floppyb.img, status=inserted # Cylinder, head, and spt info taken from bximage program output diskc: file="/home/david/win98/c.img", cyl=3657, heads=16, spt=63 # Have your Windows 98 CD in the drive, but always boot from hard disk. # Comment this line out if you are using a disk image for the CD-ROM # (See next comment). cdromd: dev=/dev/cdrom, status=inserted # You can optionally run the following command: # dd if=/dev/cdrom of=/home/david/win98/win98.iso # and uncomment the next line # cdromd: dev=/home/david/win98/win98.iso, status=inserted newharddrivesupport: enabled=1 # choose the boot disk. boot: c # where do we send log messages? log: bochsout.txt # enable mouse mouse: enabled=1 # enable SB16 sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=sb16.log, dmatimer=600000 |
Now that you have your disk image, you want to make it accessible by mtools. Add the following line to the ~/.mtoolsrc file:
drive c: file="/home/david/win98/c.img" partition=1 |
Replace /home/david with your home directory.
Save and close .mtoolsrc. Next, execute the following commands to create a partition table for the drive image:
mpartition -I -s spt -t cyl -h heads c: mpartition -cpv -s spt -t cyl -h heads c: |
For example, for my 2 gig virtual drive, I used:
mpartition -I -s 63 -t 3657 -h 16 c: mpartition -cpv -s 63 -t 3657 -h 16 c: |
Next, format the partition you just created using the mformat command:
mformat c: |
You may want to set your My Documents directory aside:
mkdir ~/mydocsbak cd ~/mydocsbak tar cfvz mydocs.tar.gz '/windows/d/My Documents' mv '/windows/d/My Documents' . |
Now you are ready to copy the files!
cd ~/win98 mcopy -s /windows/d/* c: mmd "c:/My Documents" |
Put your My Documents folder back where it belongs:
cd /windows/d mv '/home/david/mydocsbak/My Documents' . |
Make a backup copy of your c.img:
cd ~/win98 cp c.img c.img.bak |
Now it is time to fire up Bochs. Windows will initially freak out when it notices its environment has changed completely (and wouldn't you?). You may have to reboot your guest OS a few times as Windows deactivates certain devices and drivers and installs others. Since installations vary, there are no step-by-step instructions for this process. Just remember that you can always restore with your backup image if things go wrong:
cd ~/win98 cp -f c.img.bak c.img |
Make sure you get the order right. When you boot Bochs again, you will see everything as it was when you last did a cp c.img c.img.bak. If you have a large disk image, such as two Gigs, it might take a few minutes for the file to copy.
In this method, Windows 98 is installed using the CD-ROM, much the same way one would install Windows 98 into a real computer with no operating system. This process could take up to 12 hours, so I recommended that you begin at the end of your day. You could check on it once or twice when you get up for the midnight snack, and continue in the morning.
Here's a summary for the impatient:
Copy the cdimage to harddisk to increase speed.
Create a disk image with bximage.
Update your .bochsrc configuration file for the diskimage and the cdimage. Make sure that to disable the IPS parameter for full speed, unless you really need it to slow down the boot prompts.
Boot from CD, then use fdisk to partition the image and format c: /s to format it.
Start the installation with setup from the commandline. Enter information as necessary.
You can either use the keyboard only to give information, or enable and disable the mouse with the middle button or F12.
When there are CPU panics, choose alwayscont to ignore them. Amazingly, the install will work in spite of them.
Since this second method involves installing from the Windows 98 CD-ROM, you will speed things up considerably if you put an image of this disc on you hard drive. These days, some computers are shipped with "Recovery Disks" that have the Original Equipment Manufacturer (OEM) label on the MS Windows 98 disk. In these cases, it is not always easy to tell which CD-ROM contains the operating system. These types of disks may or may not work for this purpose; more than likely it will be problematic. Make sure you have a disk that is labeled "Windows 98" with the Microsoft logo. You will find the product key on the "Certificate of Authenticity" provided to you by Microsoft. This can be either on the aqua/purle/white book titled Microsoft Windows 98: Getting Started, or on your PC. You may also find it in the CD-ROM packaging. The product key is in squarish typeset next to a bar code.
Under Linux, insert your Windows 98 CD in your CD-ROM drive. Make a directory called win98 under your home directory. Copy the image using the dd command:
[david@host david]$ mkdir ~/win98 [david@host david]$ dd if=/dev/cdrom of=~/win98/win98.iso |
The appropriate line to the configuration file will be added after the hard disk image is made.
Since you can select what components you want with MS Windows and which ones you do not, you have the option of having a slim installation that requires less disk space. The actual Windows portion can be as little as 150 megabytes. If you only plan to run Microsoft Word plus a couple of programs, one Gigabyte will be more than sufficient.
It is recommended that you put your office and personal files on a separate image. This allows for easier backup and restoration of your installation as you go along.
Type "df" at the command prompt to see how much disk space you have:
[david@host david]$ df Filesystem 1k-blocks Used Available Use% Mounted on /dev/hda6 5580848 3328772 1968580 63% / /dev/hda2 21958 5763 15061 28% /boot /dev/hda5 4464560 1350568 2887200 32% /home none 192272 0 192272 0% /dev/shm /dev/hda1 7054136 3037024 3658772 46% /home2 /dev/hda3 4142332 1843132 2299200 45% /windows/d [david@192 user]$ |
In this case, /home is mounted on /dev/hda5. There is 2,887,200 bytes, or roughly 2.8 Gigabytes available. There is enough space for the primary 1 Gigabyte image (c.img) and the backup image (c.img.bak). You will now create the image using bximage:
[david@host david]$ bximage ======================================================================== bximage Disk Image Creation Tool for Bochs ======================================================================== Do you want to create a floppy disk image or a hard disk image? Please type hd or fd. [hd] hd What kind of image should I create? Please type flat, sparse or growing. [flat] Enter the hard disk size in megabytes, between 1 and 32255 [10] 1000 I will create a hard disk image with cyl=2031 heads=16 sectors per track=63 total sectors=2047248 total size=999.63 megabytes What should I name the image? [c.img] c.img Writing: [] Done. I wrote 1048190976 bytes to c.img. The following line should appear in your bochsrc: ata0-master: type=disk, path="c.img", cylinders=2031, heads=16, spt=63 |
You will need the output of bximage for your ~/win98/.bochsrc file. Be sure to copy down the line that begins with ata0-master, etc. onto a piece of paper or onto your desktop clibpoard. See the example provided below for details on the syntax.
Now that you have the disk image information, it is time to create the ~/win98/.bochsrc file. In the following example, you will need to replace all instances of /home/david/ with your own home directory. All paths in the ~/win98/.bochsrc file must be absolute.
# .bochsrc FILE FOR WINDOWS 98 AS GUEST OS IN LINUX # Set aside the RAM for bochs and make sure you have enough RAM left over for your system. # Type "cat /proc/meminfo" at the prompt to find out how much RAM you have. megs: 64 # Filename of ROM images go here. Be sure to check your installation for the location # of these two files (type: man find). Paths must be absolute. romimage: file=/usr/local/etc/bochs/bios/BIOS-bochs-latest, address=0xf0000 vgaromimage: /usr/local/etc/bochs/bios/VGABIOS-elpin-2.40 # Floppies are commented out, but you may need them later. # floppya: 1_44=/dev/fd0, status=inserted # floppyb: 1_44=/home/david/win98/floppyb.img, status=inserted # Cylinder, head, and spt info taken from bximage program output diskc: file="/home/david/win98/c.img", cyl=2031, heads=16, spt=63 # If you ran the following command: # dd if=/dev/cdrom of=/home/david/win98/win98.iso # you can use the CD-ROM image on your hard drive: cdromd: dev=/home/david/win98/win98.iso, status=inserted # Optionally, if you have your Windows 98 CD in the drive # you can uncomment the next line, but the installation # process will be slower. # cdromd: dev=/dev/cdrom, status=inserted newharddrivesupport: enabled=1 # choose the boot disk. boot: cdrom # where do we send log messages? log: bochsout.txt # enable mouse mouse: enabled=1 # enable SB16 sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=sb16.log, dmatimer=600000 |
Change into the ~/win98 directory. Fire up Bochs. (If Bochs does not start, double check your .bochsrc file and make sure there are no mispellings). Choose "CD-ROM" when Windows prompts you to choose hard disk or CD-ROM. You can use your arrow keys to select your option, or type the number "2".
Microsoft Windows 98 CD-ROM Startu Menu ============================================ 1. Boot From Hard Disk 2. Boot From CD-ROM Enter your choice: _ |
Tip: If you are not given enough time to make this choice, close Bochs, and add the following line to your .bochsrc:
ips: 1000000Fire up Bochs again. If you have a 1 Gigahertz processor, an ips setting of 1 million will keep you on your toes when it comes time to select the CD-ROM. Just be sure to comment this line out or delete it before you begin the actual installation, otherwise it will take too long to complete this project.
However, if you can manage to press quickly any key before the time is up, you don't need to do use this trick.
After you select the CD-ROM as your boot method, you will now see a menu with three choices:
Microsoft Windows 98 CD-ROM Startu Menu ============================================ 1. Start Windows 98 setup from CD-ROM. 2. Start computer with CD-ROM support. 3. Start computer without CD-ROM support. Enter a choice: _ |
Type "2" and press "Enter" to Start computer with CD-ROM support. This will take you to a DOS prompt. At the DOS prompt, type fdisk and press "Enter".
A:\>fdisk |
You will now be taken to a screen asking you if you would like to enable large disk support. Type "Y" and press "Enter". You will now see the following menu:
Microsoft Windows 98 Fixed Disk Setup Program FDISK Options Current fixed disk drive: 1 Choose one of the following: 1. Create DOS partition or Logical DOS Drive 2. Set active partition 3. Delete partition or Logical DOS Drive 4. Display partition information Enter choice: [1] Press Esc to exit FDISK |
Type "1" and press "Enter" to select Create DOS partition or Logical DOS Drive. You will be taken to another menu:
Create DOS Partition or Logical DOS Drive Current fixed disk drive: 1 Choose one of the following: 1. Create Primary DOS Partition 2. Create Extended DOS Partition 3. Create Logical DOS Drive(s) in the Extended DOS Partition Enter choice: [1] Press Esc to return to FDISK Options |
Type "1" and press enter to select Create Primary DOS Partition. You will then be asked the following:
Do you wish to use the maximum available size for a Primary DOS partition and make the partition active (Y/N).................? [Y] |
Type "Y" and press "Enter". You should then see the following message:
You MUST restart your system for your changes to take effect. Any drives you have created or changed must be formatted AFTER you restart. Shut down Windows before restarting. Pres Esc to exit FDISK_ |
Type "Esc" to exit FDISK. You should be back at the DOS prompt. Click on the Bochs "Power" button.
We now need to format the virtual "C" drive for your guest OS.
Fire up Bochs from the ~/win98 directory. Type "2" and press "Enter" to select booting from the Windows 98 CD-ROM. Then Type "2" and press "Enter" to select booting with CD-ROM support. You should be at the DOS prompt once again. Select the "D" drive, change to the "WIN98" directory, and type "format c:". You will then be asked the following:
A:/>D: D:/>cd WIN98 D:/WIN98>format c: /s WARNING, ALL DATA ON NON-REMOVABLE DISK DRIVE C: WILL BE LOST! Proceed with Format (Y/N)?_ |
Type "Y" and press "Enter" to format. The process should take no more than a minute on a modern computer. You will then be asked for the disk label. Hit "Enter". If you are successful, you should see output similar to the following:
Formatting 999.1M Format complete. Writing out file allocation table Complete. Calculating free space (this may take several minutes)... Complete. Volume label (11 characters, ENTER for none)? 1,045,577,728 bytes total disk space 1,045,577,728 bytes available on disk 4,096 bytes in each allocation unit. 255,267 allocation units available on disk. Volume Serial Number is 555D-1F23 D:\WIN98> |
It is now time to comment out the "ips: 1000000" line in your ~/win98/.bochsrc file. Close Bochs by clicking the Bochs power button with your mouse. Open up ~/win98/.bochsrc with your favorite editor and put a hash (#) mark in front of the ips line.
You are now ready to begin the installation.
Fire up Bochs from the ~/win98 directory. Type "2" and press "Enter" to select booting from the Windows 98 CD-ROM. Then Type "2" and press "Enter" to select booting with CD-ROM support. You should be at the DOS prompt once again. Select the "D" drive, change to the "WIN98" directory, and type "setup":
A:\>D: D:\>cd WIN98 D:\WIN98>setup |
Tip: You can also use setup /is to bypass scandisk.
Answer the question of the Windows 98 installer. You can either supply answers with the keyboard including the arrow keys, or activate the mouse with the middle mouse button or F12.
I choose a minimal installation to save space on the harddisk image, but others should probably also work.
(Add additional detailed step-by-step information here if really necessary)
At some stage during the installation, the simulation will stop with an audible beep and notify you about a CPU panic. Don't worry, choose alwayscont to ignore all such future panics (there will be several others). Windows will install properly in spite of those errors.
If you want, you can create checkpoints of your harddisk image at apropriate times (before a reboot, for example). Stop the simulation by clicking on the Tool icon, copy the image file, and continue by pressing return in the bochs terminal window. Optionally, gzip the copied disk image to conserve some space.
Add more details, if needed.